package gui.keyActions;

import gui.MainPanel;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import dados.Curva;

public class SetAllCurvesVisibilityAction extends AbstractAction {
	private MainPanel target;
	private boolean visibility;

	public SetAllCurvesVisibilityAction(MainPanel target) {
		super();
		this.target = target;
		this.visibility = true;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		this.visibility = !this.visibility;
		this.target.getDrawPanel().setAllCurvesVisible(this.visibility);
		for (Curva c : this.target.getDrawPanel().getDraw().getCurves()) {
			c.setCurveVisible(this.visibility);
		}
		this.target.getButtonPanel().getCheckBoxCurva().setSelected(this.visibility);
		this.target.getDrawPanel().update();
		
		
	}

}
